@extends('public.father')
@section('title','会员列表页')
@section('content')
<div class="container">
    <div class="jumbotron">
        @include('public._errors')
        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th>id</th>
                <th>用户名</th>
                <th>邮箱</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($users as $user)
            <tr>
                <td>{{$user->id}}</td>
                <td scope="row">{{$user->name}}</td>
                <td>{{$user->email}}</td>
                <td>
                    <div class="btn-group">
                        <a href="{{route('user.show',$user->id)}}" class="btn btn-primary">查看ta的文章</a>
                        @can('update',$user)
                        <a href="{{route('user.edit',$user->id)}}" class="btn btn-success">编辑</a>
                        @endcan
                        @can('delete',$user)
                                <form action="{{route('user.destroy',$user)}}" method="post">
                                    @csrf
                                    @method('delete')
                        <button type="submit" class="btn btn-danger">删除</button>
                                </form>
                            @endcan
                    </div>
                </td>
            </tr>
            @endforeach
            </tbody>
        </table>
        {{ $users->links() }}


    </div>
</div>
    @endsection